import os
import sys

sys.path.insert(0, '../../../')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ihome.settings.dev')
import time


def compare_time(order1_s, order1_e, order2_s, order2_e):
    os1 = time.mktime(time.strptime(order1_s, '%Y-%m-%d'))
    oe1 = time.mktime(time.strptime(order1_e, '%Y-%m-%d'))
    os2 = time.mktime(time.strptime(order2_s, '%Y-%m-%d'))
    oe2 = time.mktime(time.strptime(order2_e, '%Y-%m-%d'))

    if os1 < os2 < oe1 or os1 < oe2 < oe1:
        return 'NG'
    else:
        return 'OK'
